extends Area2D

@export var speed = 10


# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	pass # Replace with function body.


func _physics_process(delta: float) -> void:
	for i in get_overlapping_areas():
		pass
	var y1 = Input.get_action_raw_strength("p2_up")
	var y2 = Input.get_action_raw_strength("p2_down")
	var y3 = position.y - speed*y1 + speed*y2
	if y3 > 16 and  y3 < 630:
		position.y = y3


func _on_area_entered(area: Area2D) -> void:
	if area.is_in_group("Ball"):
		$sound.play()
		area.vec.x = -5
